package com.ljh.account.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.filter.CommonsRequestLoggingFilter;

//一个配置文件，用于打印用户的所有请求，不关键
@Configuration
public class RequestLoggingConfig {

    @Bean
    public CommonsRequestLoggingFilter logFilter() {
        CommonsRequestLoggingFilter filter = new CommonsRequestLoggingFilter();
        filter.setIncludeClientInfo(true); // 包含客户端信息
        filter.setIncludeQueryString(true); // 包含查询字符串
        filter.setIncludePayload(true); // 包含请求体
        filter.setIncludeHeaders(true); // 包含请求头
        filter.setAfterMessagePrefix("Request Data: "); // 设置前缀
        return filter;
    }
}
